.multi-level-tree {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #333;

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  // 搜索框样式
  .tree-search-box {
    position: relative;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
  }

  .tree-search-input {
    width: 100%;
    padding: 8px 32px 8px 36px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;

    &:focus {
      border-color: #1890ff;
      box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
    }

    &::placeholder {
      color: #bfbfbf;
    }
  }

  .tree-search-icon {
    position: absolute;
    left: 10px;
    top: 8px;
    font-size: 16px;
    pointer-events: none;
  }

  .tree-search-clear {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    border-radius: 50%;
    transition: all 0.2s;

    &:hover {
      background-color: #f5f5f5;
      color: #333;
    }
  }

  .tree-search-result {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: right;
  }

  .tree-list {
    padding: 0;
  }

  .tree-node {
    margin: 0;
    padding: 0;
  }

  .tree-node-content {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    transition: background-color 0.2s;

    &:hover {
      background-color: #f5f5f5;
    }

    // 高亮匹配的节点
    &.highlighted {
      background-color: #fff7e6;
      border-left: 3px solid #faad14;
      padding-left: 5px;
      animation: highlightFade 0.6s ease;
    }

    @keyframes highlightFade {
      0% {
        background-color: #fffbe6;
      }
      100% {
        background-color: #fff7e6;
      }
    }
  }

  .tree-node-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    cursor: pointer;
    user-select: none;
    border-radius: 2px;
    transition: background-color 0.2s;

    &:hover {
      background-color: #e0e0e0;
    }

    .toggle-icon {
      font-style: normal;
      font-size: 16px;
      font-weight: bold;
      color: #666;
      transition: transform 0.2s ease;
      display: inline-block;
      line-height: 1;

      &.expanded {
        transform: rotate(90deg);
      }
    }
  }

  .tree-node-toggle-placeholder {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 4px;
  }

  .tree-node-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    user-select: none;
  }

  .tree-checkbox {
    margin: 0 8px 0 0;
    cursor: pointer;
    width: 16px;
    height: 16px;

    &.indeterminate {
      position: relative;

      &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 8px;
        height: 2px;
        background-color: #1890ff;
      }
    }
  }

  .tree-node-text {
    flex: 1;
    line-height: 20px;

    // 搜索高亮样式
    .search-highlight {
      background-color: #ffeb3b;
      color: #333;
      font-weight: 600;
      padding: 2px 0;
      border-radius: 2px;
    }
  }

  .tree-children {
    padding-left: 24px;
  }

  // 美化复选框
  input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;

    &:hover {
      border-color: #1890ff;
    }

    &:checked {
      background-color: #1890ff;
      border-color: #1890ff;

      &::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 5px;
        width: 4px;
        height: 8px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
      }
    }

    &.indeterminate {
      background-color: #1890ff;
      border-color: #1890ff;

      &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 8px;
        height: 2px;
        background-color: white;
      }
    }
  }
}
